package com.jqb.controller;

import javax.inject.Inject;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.jqb.model.User;
import com.jqb.service.IUserService;

@Controller("userController")
@Scope("prototype")   //设置多例
public class UserController {
	private User user;
	private int id;
	private IUserService userService;

	public IUserService getUserService() {
		return userService;
	}
	@Inject //这个是jsr330标准规范,和@Resource效果一样
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void add(User user) {
		userService.addUser(user);
	}

	public void delete(int id) {
		userService.delUser(id);
	}

	public void update(int id) {
		userService.updateUser(id);
	}

	public User load(int id) {
		userService.load(id);
		return null;
	}

}
